In a picture compression system employing combination of motion compensation and DCT (Discrete Cosine Transform) represented by an MPEG (Moving Pictures Expert Group) standard, a code amount is controlled so that a bit stream should be transferred to a transmission line at a desired bit rate. A conventional control of the encoding amount is a feed-back control of a quantizing step based on a relationship between a previous quantizing step and a previous code amount and also on a present mean bit rate.
FIG. 7 shows an example of a picture compression and encoding apparatus employing combination of motion compensation and DCT. A digital input video signal is supplied through an input terminal T1 to a scan converter circuit 1. The scan converter circuit divides a picture of one frame into a large number of macroblocks. According to the MPEG standard, a macroblock of a luminance signal has a size of (16.times.16) formed of four DCT blocks. Each of macroblocks of color difference signals Cr, Cb each has a size of (8.times.8) formed of two DCT blocks in the case of (4:2:2). One macroblock is formed of total 8 DCT blocks.
Data converted into data of macroblocks by the scan converter circuit 1 are supplied to a subtracting circuit 2 and to a motion detection unit 3 for calculating a motion vector. The motion detection unit 3 calculates a motion vector with respect to the present macroblock with reference to a reference picture. The motion vector is supplied to a motion compensation unit 4 which carries out motion compensation using the motion vector. In this operation for the motion compensation, a locally coded data described later on is employed as the reference picture for carrying out the same motion compensation as that carried out by the decoder side.
If the data of the macroblock is to be processed for an intraframe coding, then the subtracting circuit 2 supplies the data to a DCT processing unit 5 as it is without carrying out the subtraction processing. If on the other hand the data of the macroblock is to be processed for an interframe coding, the subtracting circuit 2 calculates difference between the data and a picture data from the motion compensation unit 4 and supplies the calculated difference to the DCT processing unit 5.
The DCT processing unit 5 effects the DCT on every DCT block of (8.times.8) to generate a DCT coefficient data. A quantizer 6 quantizes the coefficient data therefrom with a quantizing step. A variable-length encoder 7 variable-length encodes data quantized by the quantizer 6 (referred to as a quantization level). The variable length encoder 7 outputs data to a buffer 8. A bit stream output from the buffer 8 is supplied to a transmission line through an output terminal T2. The quantizing step of the quantizer 6 is controlled in order to set a bit rate of the output from the buffer 8 constant in response to the bit rate of the transmission line.
The data output from the quantizer 6 is also supplied to an inverse quantizer 9. Data (representative value) output from the inverse quantizer 9 is supplied to an inverse DCT processing unit 10. The inverse DCT processing unit 10 provides a decoded video data of a sample picture. If the video data is one for the intraframe coding, then the video data for the sample picture becomes the data of a local decoded picture as it is. If on the other hand the data is one for the interframe coding, then an adder circuit 11 adds the video data to the video data supplied from the motion-compensated picture unit 4, thereby a decoded picture data being obtained.
When the code amount is controlled, a quantization index indicative of the quantizing step of the quantizer 5 is controlled. A code amount control proposed as a test model in an MPEG2 standard is a code amount control that is a feed back control employing a remaining amount of a virtual buffer and a relationship between a quantization index used upon a previous encoding and an amount of codes generated thereby.
The above conventional code amount control encounters the following problems.
First, since the code amount control is the feed back control, if a damping amount is set smaller, then response becomes faster but the processing becomes oscillatory, and if on the other hand the damping amount is set larger, then the oscillation of the processing is reduced but the response becomes slower.
Secondarily, since the bit rate instantaneously becomes large when a scene of a picture is changed, a reproduced picture becomes erroneous or extremely deteriorated in picture quality.
Thirdly, it is difficult to control frames of a predetermined number to be transferred at a predetermined bit rate.
To solve the above problems, a system of controlling the code amount by a feed forward system is considered. According to this system, an amount of codes generated in an equal-length unit is previously calculated with respect to a plurality of quantizing steps and a proper quantizing step is set within the range in which the amount of the generated codes does not exceed a target amount of codes.
A GOP (Group Of Picture), a frame, a macroblock and so on are considered as the equal-length unit used in such code-amount control of the feed-forward system. The GOP is a picture data formed of one frame or greater. The MPEG2 is established to control the code amount at a GOP unit.
As described above, when the code amount is controlled, a plurality of quantizing steps have different fixed values and one of these quantizing steps is selected for the GOP, which brings the problem that a picture quality of a decoded picture is different depending upon the macroblocks. For example, a picture quality of a macroblock of a minute picture is deteriorated, and conversely that of a macroblock of a flat picture is improved. If picture qualities of the adjacent macroblocks are considerably different from each other as described above, then a block distortion is caused.
Therefore, an object of the present invention is to provide a method of encoding a video signal and an apparatus therefor which can improve a picture quality of a decoded picture by employing a code amount control of a feed-forward system for allowing the control corresponding to a local characteristic of a video signal.